Booleans

The standard boolean objects for true and false are written as <#10#><#10#> and .<#11#>t<#11#><#12#>f<#12#> What really matters, though, are the objects that the Scheme conditional expressions (<#13#>if<#13#>, <#14#>cond<#14#>, <#15#>and<#15#>, <#16#>or<#16#>, <#17#>do<#17#>) treat as true or false. The phrase ``a true value'' (or sometimes just ``true'') means any object treated as true by the conditional expressions, and the phrase ``a false value'' (or ``false'') means any object treated as false by the conditional expressions.

Of all the standard Scheme values, only <#20#><#20#> and the empty list count as false in conditional expressions. Everything else, including , pairs, symbols, numbers, strings, vectors, and procedures, counts as true.

The empty list counts as false for compatibility with existing programs and implementations that assume this to be the case.

Programmers accustomed to other dialects of Lisp should beware that Scheme distinguishes <#22#><#22#> and the empty list from the symbol <#23#>nil<#23#>.

Boolean constants evaluate to themselves, so they don't need to be quoted in programs.


#scheme24#


#entry26#


#entry37#